<template>
  <tr>
    <td><input type="checkbox" v-model="obj.checked" /></td>
    <td>{{ obj.name }}</td>
    <td>{{ obj.price }}</td>
    <td>
      <button @click="jian(index)">-</button>
      <span>{{ obj.num }}</span>
      <button @click="jia(index)">+</button>
    </td>
    <td>{{ obj.price * obj.num }}</td>
    <td><button @click="del(index)">删除</button></td>
  </tr>
</template>

<script>
export default {
  props: ["obj", "index"],
  methods: {
    jian(index) {
      this.$emit("jian-todo", index);
    },
    jia(index) {
      this.$emit("jia-todo", index);
    },
    del(index){
        this.$emit("del-todo",index)
    }
  },
};
</script>

<style>
</style>